Home |
| Latest | About | Random
# Collatz conjecture Suggested code solution. ```cpp #include using namespace std; int main() { int N; cout << "Please enter an integer > 1: "; cin >> N; while(N != 1){ cout << N << ' '; if (N % 2 == 0) { N = N / 2; } else { N = 3 * N + 1; } } cout << endl << "And we have finally reached " << N; return 0; } ```